import { createWebHistory, createRouter } from 'vue-router'
import Layout from '../views/Layout.vue'
import Register from '../views/Register.vue'
import Login from '../views/Login.vue'

import Plan from "../views/Plan.vue";
import Diary from "../views/Diary.vue";
import Emo from "../views/Emo.vue";
import My from "../views/My.vue";
import AddPlan from "../views/AddPlan.vue";
import AddDiary from "../views/AddDiary.vue";
import AddEmo from "../views/AddEmo.vue";
import UpdateDiary from "../views/UpdateDiary.vue";
import UpdateInfo from "../views/UpdateInfo.vue";
import UpdatePass from "../views/UpdatePass.vue";
import HideDiary from "../views/HideDiary.vue";
import Mindfulness from "../views/Mindfulness.vue";
export const constantRoutes = [
    {
        path: "/layout",
        component: Layout,
        children:[
            { path: '/plan', component: Plan, meta:{istrun:true} },
            { path: '/diary', component: Diary, meta:{istrun:true} },
            { path: '/emo',  component: Emo,  meta:{istrun:true} },
            { path: '/my',   component: My,   meta:{istrun:true} },
            { path: '/addplan', component: AddPlan },
            { path: '/adddiary', component: AddDiary },
            { path: '/addemo', component: AddEmo },
            { path: '/updateinfo', component: UpdateInfo },
            { path: '/updatepass', component: UpdatePass },
            { path: '/hidediary', component: HideDiary },
            { path: '/mindfulness', component: Mindfulness },
            { path: '/updatediary', component: UpdateDiary },
        ]
    },
    { path: '/register', component: Register },
    { path: '/login', component: Login },
    { path: '/', component: Layout },
]

const router = createRouter({
    history: createWebHistory(),
    routes: [...constantRoutes]
})

export default router;